<template>
  <div>
    <el-table :data="returnShopInfoList">
      <el-table-column prop="returnNumber" label="退货编号">
        <template slot-scope="scope">
          <el-link type="primary" @click="showDetail(scope.row.id)">{{scope.row.returnNumber}}</el-link>
        </template>
      </el-table-column>
      <el-table-column prop="shopState" label="用户接收状态">
        <template slot-scope="scope">
          <div v-if="scope.row.shopState==0">未收到货</div>
          <div v-if="scope.row.shopState==1">已收到货</div>
        </template>
      </el-table-column>
      <el-table-column prop="returnCase.name" label="退货原因"></el-table-column>
      <el-table-column prop="money" label="退货金额"></el-table-column>
      <el-table-column prop="returnTime" label="退货时间"></el-table-column>
      <el-table-column prop="remark" label="退货备注"></el-table-column>
      <el-table-column label="退货单状态">
        <el-tag type="warning">签收完成，等待入库</el-tag>
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button size="mini" type="danger" @click="warehousing(scope.row.id)">选择入库仓库</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="pageno"
      :page-sizes="[5, 10, 15, 20]"
      :page-size="pagesize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total"
    ></el-pagination>
    <!--查询等待分配的供应商商品对话框-->
    <div>
      <el-dialog
        title="为退货商品选择仓库"
        :visible.sync="t1_Visible"
        width="70%">
        <component ref="tabrkth_T1dialog" is="tabrkth_T1dialog"></component>
        <div slot="footer" class="dialog-footer">
          <el-button @click="t1_Visible = false">取 消</el-button>
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script>
  import tabrkth_T1dialog from "./tabrkth_T1dialog";
    export default {
        name: "tabrkth",
        data(){
          return{
            t1_Visible:false,
            returnShopInfoList: [],
            pageno: 1,
            pagesize: 5,
            total: 1
          }
        },
        methods:{
          getData(){
            let returnShopInfo={
              goodsState:7,//7:总店签收成功，等待总店入库
              isDelete:0,//未删除
              isDesign:0//未设计
            };
            let params = new URLSearchParams();
            params.append("pageno", this.pageno);
            params.append("pagesize", this.pagesize);
            Object.keys(returnShopInfo).forEach(item => {
              params.append(item, returnShopInfo[item]);
            });
            this.$axios.get("queryAllReturn.action", {params: params})
              .then(res => {
                this.returnShopInfoList = res.data.records;
                this.total = res.data.total;
              })
              .catch(err => {
                this.$message.error(err)
              })
          },
          warehousing(id){
            //打开对话框
            this.t1_Visible=true;
            //调用子组件函数，根据退货表id，获取可以存放的仓库有哪些
            this.$nextTick(item=>{
              this.$refs.tabrkth_T1dialog.getData(id);
              //重新刷新数据
              this.getData();
            });
          },
          handleSizeChange(val) {
            //每页范围
            this.pagesize = val;
            this.getData();
          },
          handleCurrentChange(val) {
            //当前页
            this.pageno = val;
            this.getData();
          }
        },
        created() {
          this.getData();
        },
        components:{
          tabrkth_T1dialog
        }
    }
</script>

<style scoped>

</style>
